﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Kompetition
{
    partial class ShowQuestion : Form
    {
        Question question;
        Category category;
        Competition competition;

        public ShowQuestion(Question q, Category c, Competition co)
        {
            question = q;
            category = c;
            competition = co;

            InitializeComponent();

            labelQuestionText.Text = q.QuestionText;
            labelPointDisp.Text = c.GetPointValue(q).ToString() + "pt " + c.Name + " Question";
            if (q.Image != null)
                pictureBoxImage.Image = q.Image;
        }

        private void buttonCancel_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void buttonSubmit_Click(object sender, EventArgs e)
        {
            if (competition.AnswerQuestion(category, question, maskedTextBoxAnswer.Text))
                MessageBox.Show("You got this question right for " + category.GetPointValue(question).ToString() + " points!", "Kompetition");
            else
                MessageBox.Show("You got this question wrong.", "Kompetition");
            Close();
        }
    }
}
